home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / Lists.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  11.9 KB  |  428 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Lists.h
  3.  
  4.      Contains:    List Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __LISTS__
  18. #define __LISTS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __CONTROLS__
  24. #include <Controls.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. typedef Point                             Cell;
  50. typedef Rect                             ListBounds;
  51. typedef char                             DataArray[32001];
  52. typedef char *                            DataPtr;
  53. typedef DataPtr *                        DataHandle;
  54. typedef CALLBACK_API( short , ListSearchProcPtr )(Ptr aPtr, Ptr bPtr, short aLen, short bLen);
  55. typedef CALLBACK_API( Boolean , ListClickLoopProcPtr )(void );
  56. /*
  57.     WARNING: ListClickLoopProcPtr uses register based parameters under classic 68k
  58.              and cannot be written in a high-level language without 
  59.              the help of mixed mode or assembly glue.
  60. */
  61. typedef STACK_UPP_TYPE(ListSearchProcPtr)                         ListSearchUPP;
  62. typedef REGISTER_UPP_TYPE(ListClickLoopProcPtr)                 ListClickLoopUPP;
  63. #if !TARGET_OS_MAC
  64. /* QuickTime 3.0 */
  65. typedef long                             ListNotification;
  66.  
  67. enum {
  68.     listNotifyNothing            = FOUR_CHAR_CODE('nada'),        /* No (null) notification*/
  69.     listNotifyClick                = FOUR_CHAR_CODE('clik'),        /* Control was clicked*/
  70.     listNotifyDoubleClick        = FOUR_CHAR_CODE('dblc'),        /* Control was double-clicked*/
  71.     listNotifyPreClick            = FOUR_CHAR_CODE('pclk')        /* Control about to be clicked*/
  72. };
  73.  
  74. #endif  /* !TARGET_OS_MAC */
  75.  
  76.  
  77. struct ListRec {
  78.     Rect                             rView;
  79.     GrafPtr                         port;
  80.     Point                             indent;
  81.     Point                             cellSize;
  82.     ListBounds                         visible;
  83.     ControlHandle                     vScroll;
  84.     ControlHandle                     hScroll;
  85.     SInt8                             selFlags;
  86.     Boolean                         lActive;
  87.     SInt8                             lReserved;
  88.     SInt8                             listFlags;
  89.     long                             clikTime;
  90.     Point                             clikLoc;
  91.     Point                             mouseLoc;
  92.     ListClickLoopUPP                 lClickLoop;
  93.     Cell                             lastClick;
  94.     long                             refCon;
  95.     Handle                             listDefProc;
  96.     Handle                             userHandle;
  97.     ListBounds                         dataBounds;
  98.     DataHandle                         cells;
  99.     short                             maxIndex;
  100.     short                             cellArray[1];
  101. };
  102. typedef struct ListRec                    ListRec;
  103.  
  104. typedef ListRec *                        ListPtr;
  105. typedef ListPtr *                        ListHandle;
  106. /* ListRef is obsolete.  Use ListHandle. */
  107. typedef ListHandle                         ListRef;
  108.  
  109.  
  110.  
  111. enum {
  112.                                                                 /* ListRec.listFlags bits*/
  113.     lDoVAutoscrollBit            = 1,
  114.     lDoHAutoscrollBit            = 0
  115. };
  116.  
  117.  
  118. enum {
  119.                                                                 /* ListRec.listFlags masks*/
  120.     lDoVAutoscroll                = 2,
  121.     lDoHAutoscroll                = 1
  122. };
  123.  
  124.  
  125.  
  126. enum {
  127.                                                                 /* ListRec.selFlags bits*/
  128.     lOnlyOneBit                    = 7,
  129.     lExtendDragBit                = 6,
  130.     lNoDisjointBit                = 5,
  131.     lNoExtendBit                = 4,
  132.     lNoRectBit                    = 3,
  133.     lUseSenseBit                = 2,
  134.     lNoNilHiliteBit                = 1
  135. };
  136.  
  137.  
  138.  
  139. enum {
  140.                                                                 /* ListRec.selFlags masks*/
  141.     lOnlyOne                    = -128,
  142.     lExtendDrag                    = 64,
  143.     lNoDisjoint                    = 32,
  144.     lNoExtend                    = 16,
  145.     lNoRect                        = 8,
  146.     lUseSense                    = 4,
  147.     lNoNilHilite                = 2
  148. };
  149.  
  150.  
  151.  
  152. enum {
  153.                                                                 /* LDEF messages*/
  154.     lInitMsg                    = 0,
  155.     lDrawMsg                    = 1,
  156.     lHiliteMsg                    = 2,
  157.     lCloseMsg                    = 3
  158. };
  159.  
  160.  
  161.  
  162.  
  163. typedef CALLBACK_API( void , ListDefProcPtr )(short lMessage, Boolean lSelect, Rect *lRect, Cell lCell, short lDataOffset, short lDataLen, ListHandle lHandle);
  164. typedef STACK_UPP_TYPE(ListDefProcPtr)                             ListDefUPP;
  165. enum { uppListSearchProcInfo = 0x00002BE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 2_bytes, 2_bytes) */
  166. enum { uppListClickLoopProcInfo = 0x00000012 };                 /* register 1_byte:D0 Func() */
  167. enum { uppListDefProcInfo = 0x000EBD80 };                         /* pascal no_return_value Func(2_bytes, 1_byte, 4_bytes, 4_bytes, 2_bytes, 2_bytes, 4_bytes) */
  168. #define NewListSearchProc(userRoutine)                             (ListSearchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppListSearchProcInfo, GetCurrentArchitecture())
  169. #define NewListClickLoopProc(userRoutine)                         (ListClickLoopUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppListClickLoopProcInfo, GetCurrentArchitecture())
  170. #define NewListDefProc(userRoutine)                             (ListDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppListDefProcInfo, GetCurrentArchitecture())
  171. #define CallListSearchProc(userRoutine, aPtr, bPtr, aLen, bLen)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppListSearchProcInfo, (aPtr), (bPtr), (aLen), (bLen))
  172. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  173.     #pragma parameter __D0 CallListClickLoopProc(__A0)
  174.     Boolean CallListClickLoopProc(ListClickLoopUPP routine) = 0x4E90;
  175. #else
  176.     #define CallListClickLoopProc(userRoutine)                     CALL_ZERO_PARAMETER_UPP((userRoutine), uppListClickLoopProcInfo)
  177. #endif
  178. #define CallListDefProc(userRoutine, lMessage, lSelect, lRect, lCell, lDataOffset, lDataLen, lHandle)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppListDefProcInfo, (lMessage), (lSelect), (lRect), (lCell), (lDataOffset), (lDataLen), (lHandle))
  179.  
  180.  
  181. #if !TARGET_OS_MAC
  182. /* QuickTime 3.0 */
  183. typedef CALLBACK_API( void , ListNotificationProcPtr )(ListHandle theList, ListNotification notification, long param);
  184. EXTERN_API_C( void )
  185. LSetNotificationCallback        (ListNotificationProcPtr  callBack,
  186.                                  ListHandle             lHandle);
  187.  
  188. #endif  /* !TARGET_OS_MAC */
  189.  
  190.  
  191.  
  192. EXTERN_API( ListHandle )
  193. LNew                            (const Rect *            rView,
  194.                                  const ListBounds *        dataBounds,
  195.                                  Point                     cSize,
  196.                                  short                     theProc,
  197.                                  WindowPtr                 theWindow,
  198.                                  Boolean                 drawIt,
  199.                                  Boolean                 hasGrow,
  200.                                  Boolean                 scrollHoriz,
  201.                                  Boolean                 scrollVert)                            THREEWORDINLINE(0x3F3C, 0x0044, 0xA9E7);
  202.  
  203. EXTERN_API( void )
  204. LDispose                        (ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0028, 0xA9E7);
  205.  
  206. EXTERN_API( short )
  207. LAddColumn                        (short                     count,
  208.                                  short                     colNum,
  209.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0004, 0xA9E7);
  210.  
  211. EXTERN_API( short )
  212. LAddRow                            (short                     count,
  213.                                  short                     rowNum,
  214.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0008, 0xA9E7);
  215.  
  216. EXTERN_API( void )
  217. LDelColumn                        (short                     count,
  218.                                  short                     colNum,
  219.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0020, 0xA9E7);
  220.  
  221. EXTERN_API( void )
  222. LDelRow                            (short                     count,
  223.                                  short                     rowNum,
  224.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0024, 0xA9E7);
  225.  
  226. EXTERN_API( Boolean )
  227. LGetSelect                        (Boolean                 next,
  228.                                  Cell *                    theCell,
  229.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x003C, 0xA9E7);
  230.  
  231. EXTERN_API( Cell )
  232. LLastClick                        (ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0040, 0xA9E7);
  233.  
  234. EXTERN_API( Boolean )
  235. LNextCell                        (Boolean                 hNext,
  236.                                  Boolean                 vNext,
  237.                                  Cell *                    theCell,
  238.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0048, 0xA9E7);
  239.  
  240. EXTERN_API( Boolean )
  241. LSearch                            (const void *            dataPtr,
  242.                                  short                     dataLen,
  243.                                  ListSearchUPP             searchProc,
  244.                                  Cell *                    theCell,
  245.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0054, 0xA9E7);
  246.  
  247. EXTERN_API( void )
  248. LSize                            (short                     listWidth,
  249.                                  short                     listHeight,
  250.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0060, 0xA9E7);
  251.  
  252. EXTERN_API( void )
  253. LSetDrawingMode                    (Boolean                 drawIt,
  254.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x002C, 0xA9E7);
  255.  
  256. EXTERN_API( void )
  257. LScroll                            (short                     dCols,
  258.                                  short                     dRows,
  259.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0050, 0xA9E7);
  260.  
  261. EXTERN_API( void )
  262. LAutoScroll                        (ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0010, 0xA9E7);
  263.  
  264. EXTERN_API( void )
  265. LUpdate                            (RgnHandle                 theRgn,
  266.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0064, 0xA9E7);
  267.  
  268. EXTERN_API( void )
  269. LActivate                        (Boolean                 act,
  270.                                  ListHandle             lHandle)                            TWOWORDINLINE(0x4267, 0xA9E7);
  271.  
  272. EXTERN_API( void )
  273. LCellSize                        (Point                     cSize,
  274.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0014, 0xA9E7);
  275.  
  276. EXTERN_API( Boolean )
  277. LClick                            (Point                     pt,
  278.                                  short                     modifiers,
  279.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0018, 0xA9E7);
  280.  
  281. EXTERN_API( void )
  282. LAddToCell                        (const void *            dataPtr,
  283.                                  short                     dataLen,
  284.                                  Cell                     theCell,
  285.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x000C, 0xA9E7);
  286.  
  287. EXTERN_API( void )
  288. LClrCell                        (Cell                     theCell,
  289.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x001C, 0xA9E7);
  290.  
  291. EXTERN_API( void )
  292. LGetCell                        (void *                    dataPtr,
  293.                                  short *                dataLen,
  294.                                  Cell                     theCell,
  295.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0038, 0xA9E7);
  296.  
  297. EXTERN_API( void )
  298. LRect                            (Rect *                    cellRect,
  299.                                  Cell                     theCell,
  300.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x004C, 0xA9E7);
  301.  
  302. EXTERN_API( void )
  303. LSetCell                        (const void *            dataPtr,
  304.                                  short                     dataLen,
  305.                                  Cell                     theCell,
  306.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0058, 0xA9E7);
  307.  
  308. EXTERN_API( void )
  309. LSetSelect                        (Boolean                 setIt,
  310.                                  Cell                     theCell,
  311.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x005C, 0xA9E7);
  312.  
  313. EXTERN_API( void )
  314. LDraw                            (Cell                     theCell,
  315.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0030, 0xA9E7);
  316.  
  317.  
  318. EXTERN_API( void )
  319. LGetCellDataLocation            (short *                offset,
  320.                                  short *                len,
  321.                                  Cell                     theCell,
  322.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0034, 0xA9E7);
  323.  
  324. #if !TARGET_OS_MAC
  325. /* QuickTime 3.0 */
  326. EXTERN_API_C( void )
  327. LSetLDEF                        (ListDefProcPtr         proc,
  328.                                  ListRef                 lHandle);
  329.  
  330. #endif  /* !TARGET_OS_MAC */
  331.  
  332. #if CGLUESUPPORTED
  333. EXTERN_API_C( void )
  334. laddtocell                        (const void *            dataPtr,
  335.                                  short                     dataLen,
  336.                                  const Cell *            theCell,
  337.                                  ListHandle             lHandle);
  338.  
  339. EXTERN_API_C( void )
  340. lclrcell                        (const Cell *            theCell,
  341.                                  ListHandle             lHandle);
  342.  
  343. EXTERN_API_C( void )
  344. lgetcelldatalocation            (short *                offset,
  345.                                  short *                len,
  346.                                  const Cell *            theCell,
  347.                                  ListHandle             lHandle);
  348.  
  349. EXTERN_API_C( void )
  350. lgetcell                        (void *                    dataPtr,
  351.                                  short *                dataLen,
  352.                                  const Cell *            theCell,
  353.                                  ListHandle             lHandle);
  354.  
  355. EXTERN_API_C( ListHandle )
  356. lnew                            (const Rect *            rView,
  357.                                  const ListBounds *        dataBounds,
  358.                                  Point *                cSize,
  359.                                  short                     theProc,
  360.                                  WindowPtr                 theWindow,
  361.                                  Boolean                 drawIt,
  362.                                  Boolean                 hasGrow,
  363.                                  Boolean                 scrollHoriz,
  364.                                  Boolean                 scrollVert);
  365.  
  366. EXTERN_API_C( void )
  367. lrect                            (Rect *                    cellRect,
  368.                                  const Cell *            theCell,
  369.                                  ListHandle             lHandle);
  370.  
  371. EXTERN_API_C( void )
  372. lsetcell                        (const void *            dataPtr,
  373.                                  short                     dataLen,
  374.                                  const Cell *            theCell,
  375.                                  ListHandle             lHandle);
  376.  
  377. EXTERN_API_C( void )
  378. lsetselect                        (Boolean                 setIt,
  379.                                  const Cell *            theCell,
  380.                                  ListHandle             lHandle);
  381.  
  382. EXTERN_API_C( void )
  383. ldraw                            (const Cell *            theCell,
  384.                                  ListHandle             lHandle);
  385.  
  386. EXTERN_API_C( Boolean )
  387. lclick                            (Point *                pt,
  388.                                  short                     modifiers,
  389.                                  ListHandle             lHandle);
  390.  
  391. EXTERN_API_C( void )
  392. lcellsize                        (Point *                cSize,
  393.                                  ListHandle             lHandle);
  394.  
  395. #endif  /* CGLUESUPPORTED */
  396.  
  397. #if OLDROUTINENAMES
  398. #define LDoDraw(drawIt, lHandle) LSetDrawingMode(drawIt, lHandle)
  399. #define LFind(offset, len, theCell, lHandle) LGetCellDataLocation(offset, len, theCell, lHandle)
  400. #if CGLUESUPPORTED
  401. #define lfind(offset, len, theCell, lHandle) lgetcelldatalocation(offset, len, theCell, lHandle)
  402. #endif  /* CGLUESUPPORTED */
  403.  
  404. #endif  /* OLDROUTINENAMES */
  405.  
  406.  
  407.  
  408. #if PRAGMA_STRUCT_ALIGN
  409.     #pragma options align=reset
  410. #elif PRAGMA_STRUCT_PACKPUSH
  411.     #pragma pack(pop)
  412. #elif PRAGMA_STRUCT_PACK
  413.     #pragma pack()
  414. #endif
  415.  
  416. #ifdef PRAGMA_IMPORT_OFF
  417. #pragma import off
  418. #elif PRAGMA_IMPORT
  419. #pragma import reset
  420. #endif
  421.  
  422. #ifdef __cplusplus
  423. }
  424. #endif
  425.  
  426. #endif /* __LISTS__ */
  427.  
  428.